package cn.edu.xmu.oomall.liquidation.microservice;

import cn.edu.xmu.oomall.liquidation.microservice.vo.OrderItemRetVo;
import cn.edu.xmu.oomall.liquidation.microservice.vo.SimpleOrderRetVo;
import cn.edu.xmu.privilegegateway.annotation.util.InternalReturnObject;
import com.github.pagehelper.PageInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "order-service")
public interface OrderService {
    /**
     * 用orderSn查询Order
     * @param orderSn
     * @return
     */
    @GetMapping("/internal/orders")
    InternalReturnObject<SimpleOrderRetVo> getOrderBySn(@RequestParam("orderSn") String orderSn);

    /**
     * 通过父订单id获得所有子订单详细信息，类型为List
     * 这个已经写了
     * @param pid
     * @return
     */
    @GetMapping("/internal/orders/{pid}/suborders")
    InternalReturnObject<List<SimpleOrderRetVo>> getOrderByPid(@PathVariable("pid") Long pid);

    /**
     * 通过orderItem的Id获取获得OrderItem
     * @param id
     * @return
     */
    @GetMapping("/internal/orders/orderitem/{id}")
    InternalReturnObject<OrderItemRetVo> getOrderItemById(@PathVariable("id") Long id);
}
